package com.yang.ddz.controller;

import com.yang.ddz.data.User;
import com.yang.ddz.service.UserService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RestController;

@RestController
@RequestMapping("/User")
public class UserController {
    @Autowired
    private UserService userService;

    @RequestMapping(value = "/get/{id}", method = RequestMethod.GET)
    public User GetPlayer(@PathVariable Integer id) {
        System.out.println("Player:" + id);
        return userService.getByPlayerId(id);
    }

    @RequestMapping(value = "/add/{id}", method = RequestMethod.GET)
    public boolean AddPlayer(@PathVariable Integer id) {
        System.out.println("Player:" + id);
        return userService.setPlayer(id);
    }

}
